package com.aaa.sbms.controller;

import com.aaa.sbms.service.PromotionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("pro")
public class PromotionController {

    @Autowired(required = false)
    private PromotionService proService;

    /**
     * 查询部门
     * @return
     */
    @RequestMapping("depts")
    public Map depts(){
        return proService.depts();
    }

    /**
     * 查询职位
     * @return
     */
    @RequestMapping("positions")
    public Map positions(){
        return proService.positions();
    }

    /**
     * 分页查询晋升发布
     * @param map
     * @return
     */
    @RequestMapping("proPage")
    public Map proPage(@RequestParam Map map){
        return proService.proPage(map);
    }

    /**
     * 分页查询晋升发布历史记录
     * @param map
     * @return
     */
    @RequestMapping("proHistoryPage")
    public Map proHistroryPage(@RequestParam Map map){
        return proService.proHistoryPage(map);
    }

    /**
     * 分页查询晋升审核记录
     * @param map
     * @return
     */
    @RequestMapping("proCheckPage")
    public Map proCheckPage(@RequestParam Map map){
        return proService.proCheckPage(map);
    }

    /**
     * 分页查询晋升审核历史记录
     * @param map
     * @return
     */
    @RequestMapping("proRecordPage")
    public Map proRecordPage(@RequestParam Map map){
        return proService.proRecordPage(map);
    }

    /**
     * 根据id查询一条晋升发布记录
     * @param id
     * @return
     */
    @RequestMapping("proOne")
    public Map proOne(Integer id){
        return proService.proOne(id);
    }

    /**
     * 根据id查询一条晋升发布记录
     * @param id
     * @return
     */
    @RequestMapping("proCheckOne")
    public Map proCheckOne(Integer id){
        return proService.proCheckOne(id);
    }

    /**
     * 添加晋升申请
     * @param map
     * @return
     */
    @RequestMapping("addPro")
    public int addPro(@RequestBody Map map){
        return proService.addProAndHistory(map);
    }

    /**
     * 添加晋升申请
     * @param map
     * @return
     */
    @RequestMapping("addProCheck")
    public int addProCheck(@RequestBody Map map){
        return proService.addProCheck(map);
    }

    /**
     * 添加晋升申请
     * @param map
     * @return
     */
    @RequestMapping("updatePro")
    public int updatePro(@RequestBody Map map){
        return proService.updatePro(map);
    }

    /**
     * 确定审核
     * @param map
     * @return
     */
    @RequestMapping("yes")
    public Object yes(@RequestBody Map map){
        return proService.yes(map);
    }
}
